package com.gudaomai.wuye.service.impl;

import com.gudaomai.wuye.common.CommonConstant;
import com.gudaomai.wuye.common.CommonException;
import com.gudaomai.wuye.common.MsgConstant;
import com.gudaomai.wuye.entity.Butler;
import com.gudaomai.wuye.mapper.ButlerMapper;
import com.gudaomai.wuye.service.IButlerServ;
import com.gudaomai.wuye.service.impl.BaseServiceImpl;

import java.util.List;

import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zenghualu
 * @since 2017-09-01
 */
@Service
public class ButlerServImp extends BaseServiceImpl<ButlerMapper, Butler> implements IButlerServ {

	// 获取所有管家的姓名
	@Override
	public List<String> getButlersName() throws CommonException {

		List<String> names = this.baseMapper.selectButlersName();

		if (names.size() > 0) {
			return names;
		}else {
			throw new CommonException(CommonConstant.RESULT_CODE_NOT_FOUND, getMessage(MsgConstant.RET_BUTLER_SELECT_FAILURE));
		}
	}

}
